package org.example.backend.controller;


import lombok.RequiredArgsConstructor;
import org.example.backend.dto.Response;
import org.example.backend.dto.RouteDTO;
import org.example.backend.service.RouteService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

@Tag(name = "路线推荐", description = "游览路线推荐相关接口")
@RestController
@RequestMapping("/routes")
@RequiredArgsConstructor
public class RouteController {

    private final RouteService routeService;

    @Operation(summary = "生成普通游览路线")
    @GetMapping("/general")
    public Response<RouteDTO> generateRoute(
            @RequestParam Double startX,
            @RequestParam Double startY,
            @RequestParam(defaultValue = "180") Integer duration) {
        return Response.success(routeService.generateRoute(startX, startY, duration));
    }

    @Operation(summary = "生成个性化推荐路线")
    @GetMapping("/recommended")
    public Response<RouteDTO> generatePreferredRoute(
            @RequestParam Double startX,
            @RequestParam Double startY,
            @RequestParam(defaultValue = "180") Integer duration) {
        return Response.success(routeService.generatePreferredRoute(startX, startY, duration));
    }

    @Operation(summary = "生成推荐路线")
    @GetMapping("/recommend")
    public Response<RouteDTO> generateRecommendRoute(
            @RequestParam Double startX,
            @RequestParam Double startY,
            @RequestParam(defaultValue = "180") Integer duration) {
        return Response.success(routeService.generateRecommendRoute(startX, startY, duration));
    }
}
